import store from '../store'
import bigScreenApi from '@/api/bigScreen';
import {isShouldPostOfficeCodeNew} from "@/utils/commonJs"
export async function clickMore({ methodType, dataStr, dclProjectList = [], title = '' }) {
    let titleData = [
    ];
    if (title === '') {
        if (methodType == 8) {
            title = '高频问题占比'
            titleData = [
                {
                    property: "questionType",
                    label: "高频问题名称",
                    left:true
                },
                {
                    property: "projectNum",
                    label: "数量"
                },
            ]
        }
        else if (methodType == 2) {
            title = '直接审减'
            titleData = [
                {
                    property: "projectName",
                    label: "项目名称",
                    left:true
                },
                {
                    property: "projectType",
                    label: "项目类型",
                    left:true
                },
                {
                    property: "auditStatus",
                    label: "状态",
                    left:true
                },
                {
                    property: "searchCreateDate",
                    label: "年份",
                    left:true
                },
            ];
        }
        else if (methodType == 1) {
            title = '审计项目'
            titleData = [
                {
                    property: "projectName",
                    label: "项目名称",
                    left:true
                },
                {
                    property: "projectType",
                    label: "项目类型",
                    left:true
                },
                {
                    property: "auditStatus",
                    label: "状态",
                    left:true
                },
                {
                    property: "searchCreateDate",
                    label: "年份",
                    left:true
                },
            ];
        }
        else if (methodType == 3) {
            title = '增加需求'
            titleData = [
                {
                    property: "projectName",
                    label: "项目名称",
                    left:true
                },
                {
                    property: "projectType",
                    label: "项目类型",
                    left:true
                },
                {
                    property: "auditStatus",
                    label: "状态",
                    left:true
                },
                {
                    property: "searchCreateDate",
                    label: "年份",
                    left:true
                },
                {
                    property: "increasePriceYS",
                    label: "金额",
                    left:true
                },
            ];
        }
        else if (methodType == 4) {
            title = '落实整改'
            titleData = [
                {
                    property: "projectName",
                    label: "项目名称",
                    left:true
                },
                {
                    property: "projectType",
                    label: "项目类型",
                    left:true
                },
                {
                    property: "auditStatus",
                    label: "状态",
                    left:true
                },
                {
                    property: "searchCreateDate",
                    label: "年份",
                    left:true
                },
            ];
        }
        else if (methodType == 5) {
            title = '审计部门'
        }
        else if (methodType == 6) {
            title = '未送审项目'
            titleData = [
                {
                    property: "projectName",
                    label: "项目名称",
                    left:true
                },
                {
                    property: "officeName",
                    label: "部门名称",
                    left:true
                },
                {
                    property: "submitAuditPrice",
                    label: "价格",
                    right:true,
                    isNeedPriceFat:true
                },
            ];
        }
        else if (methodType == 7) {
            title = '中标单位'
            titleData = [
                {
                    property: "projectName",
                    label: "项目名称",
                    left:true
                },
                {
                    property: "supplierName",
                    label: "公司名称",
                    left:true
                },
                {
                    property: "procurementType",
                    label: "类型",
                    left:true
                },
                {
                    property: "bidPrice",
                    label: "价格",
                    right:true,
                    isNeedPriceFat:true
                },
            ];
        }
        else if (methodType == 8) {
            title = '高频问题'
        }
        else {
            title = methodType
        }
    }
    store.dispatch("moreModal/setModalTitle", title);
    if (methodType === '待办事项' || methodType === '预警提示') {
        let titleData = []
        let data = {}
        if (methodType === '待办事项') {
            titleData = [{
                property: "dbContent",
                label: "名称",
                left:true
            },
            ]
        }
        if (methodType === '预警提示') {
            titleData = [ {
                property: "pName",
                label: "项目名称",
                left:true
            },{
                property: "cqType",
                label: "预警类型",
                left:true
            }, {
                property: "cqContent",
                label: "预警内容",
                left:true
            }, 
            ]
        }
        data = {
            modalData: dclProjectList,
            titleData
        }
        store.dispatch("moreModal/setData", data);
        store.dispatch("moreModal/setModalShowState", true);
    }else if(methodType === 8){
                let data = {
                    modalData: dclProjectList,
            titleData,
        };
        store.dispatch("moreModal/setData", data);
        store.dispatch("moreModal/setModalShowState", true);
    }else if(methodType === 7){
        store.dispatch("moreModal/setModalShowState", true);
    } else {
        store.state.user.userInfo.roleCode === "sjbm"
        let formData = {
            searchCreateDate: dataStr,
            qxType: 1,
            qxName: 0,
            jsCode: store.state.user.userInfo.roleCode,
            userCode: store.state.user.userInfo.userCode,
            officeCode:isShouldPostOfficeCodeNew()?'':store.state.user.userInfo.officeCode,
            methodType,
        };
        if(isShouldPostOfficeCodeNew()){
            formData.officeName = store.state.user.userInfo.officeName
        }
        const modalData = await bigScreenApi.getDPProcurementTypeList(formData);
        let data = {
            modalData,
            titleData,
        };
        store.dispatch("moreModal/setData", data);
        store.dispatch("moreModal/setModalShowState", true);
    }
}